/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gruppe7.data;

/**
 *
 * @author bertram
 */
public class Ticket {

    private String userName;
    private float price;
    private String departure;
    private String destination;
    private boolean validated = false;

    public Ticket(String userName, float price, String departure, String destination) {
        this.userName = userName;
        this.price = price;
        this.departure = departure;
        this.destination = destination;
        validate();
    }

    public boolean isValid() {
        return validated;
    }

    public String getDeparture() {
        return departure;
    }

    public String getDestination() {
        return destination;
    }

    public float getPrice() {
        return price;
    }

    public String getUserName() {
        return userName;
    }

    private void validate() {
        validated = UserController.getInstance().buyTicket(this);
    }
}
